<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<P>
<div id="msg"></div>   
<input id="btn" type="button" value="test" />  
</p>
<p>
	<a href="http://www.thespringexperience.com">
		<img src="<c:url value="/resources/images/diplomat.jpg"/>" alt="generic hotel" />
	</a>
</p>
<p>
	<a href="http://www.thespringexperience.com">
		<img src="<c:url value="/resources/images/springone2gx.jpeg"/>" alt="SpringOne 2GX" />
	</a>
</p>
<script type="text/javascript">	
	$(function(){
		$("#btn").bind("click",{btn:$("#btn")},function(evdata){
			 $.ajax({
                 type:"POST",
                 dataType:"json",
                 url:"<c:url value="/users/get_new"/>",
                 timeout:80000,	   //ajax timeout:80
                 data:{time:"10"}, //40sec must return
                 success:function(data,textStatus){
                     //return data,continue query
                     if(data.success=="1"){
                    	 $("#msg").append("<br>[data]"+data.text);
                    	 evdata.data.btn.click();
                     }
					 //nodata,continue query
                     if(data.success=="0"){
                    	$("#msg").append("<br>[no data]");
						evdata.data.btn.click();
                     }
                 },
				 //Ajax time out, continue query
	             error:function(XMLHttpRequest,textStatus,errorThrown){
	                     if(textStatus=="timeout"){
	                    	 $("#msg").append("<br>[no data]");
	                         evdata.data.btn.click();
	                     }
	             }
                 
             });
		});
		
	});
</script>